<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<p:growl id="messages" showDetail="true" showSummary="true" life="3000" />
<h:form id="form">
	<p:panel header="#{message.header_cad_tipos}">
		<h:panelGrid columns="2" id="grid">
			<h:outputLabel value="#{message.label_descricao}" for="tipoDesc"></h:outputLabel>
			<p:inputText id="tipoDesc" value="#{tipoTela.tipo.descricao}"
				required="true">
			</p:inputText>

			<p:commandButton id="btn_add" value="#{message.botao_adicionar}"
				update="tipos,:messages,@parent" action="#{tipoTela.adicionaTipo}" />
		</h:panelGrid>
	</p:panel>
	<p:outputPanel id="tipos">
		<p:dataTable id="tiposTable" value="#{tipoTela.tipos}" var="tipo"
			emptyMessage="#{message.table_empty}"
			filteredValue="#{tipoTela.tiposFiltrados}" filterDelay="150" style="margin-top:20px;"
			paginator="true" rows="5">
			<p:column>
				<f:facet name="header">
					<h:outputText value="#{message.label_codigo}" />
				</f:facet>
				<h:outputText value="#{tipo.codigo}" />
			</p:column>
			<p:column filterBy="#{tipo.descricao}" filterMatchMode="contains">
				<f:facet name="header">
					<h:outputText value="#{message.label_descricao}" />
				</f:facet>
				<h:outputText value="#{tipo.descricao}" />
			</p:column>
			<p:column>
				<f:facet name="header">
					<h:outputText value="#{message.label_operacao}" />
				</f:facet>
				<p:commandButton id="btn_add" icon="ui-icon-trash"
					update=":form:tipos" process=":form:tipos"
					action="#{tipoTela.excluirTipo(tipo)}">
					<p:tooltip for="btn_add" value="#{message.botao_excluir}" />
				</p:commandButton>
			</p:column>
		</p:dataTable>
	</p:outputPanel>
</h:form>
</html>